<template>
  <div class="z-admin">
    <div class="z-aside" :class="{ collapsed: collapsed }">
      <z-logo />
      <z-menu />
    </div>
    <div class="z-main">
      <div class="z-head">
        <div class="z-bread">
          <z-bread />
        </div>
        <div class="z-actions">
          <icon-home />
          <z-theme />
          <z-screen />
          <z-dropdown />
        </div>
      </div>
      <z-tabs />
      <div class="z-container scrollbar">
        <router-view class="z-base-view" v-slot="{ Component }">
          <transition name="fade" mode="out-in">
            <component :is="Component" />
          </transition>
        </router-view>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive, ref } from "vue";
import { theme, loadTheme, setTheme } from "@/components/common/z-theme";
import { collapsed } from "@/components/admin/z-menu";
import zTheme from "@/components/common/z-theme.vue";
import zScreen from "@/components/common/z-screen.vue";
import zMenu from "@/components/admin/z-menu.vue";
import zBread from "@/components/admin/z-bread.vue";
import zDropdown from "@/components/admin/z-dropdown.vue";
import zTabs from "@/components/admin/z-tabs.vue";
import zLogo from "@/components/admin/z-logo.vue";
</script>
<style scoped lang="less">
.z-admin {
  display: flex;
  background-color: var(--color-bg-1);
  color: @color-text-1;

  .z-aside {
    width: 240px;
    height: 100vh;
    // overflow: hidden;
    border-right: @z-border;
    transition: width 0.3s;
    &.collapsed {
      width: 48px;
      & ~ .z-main {
        width: calc(100% - 48px);
      }
    }
    .z-logo {
      width: 100%;
      height: 90px;
      border-bottom: @z-border;
    }
  }

  .z-main {
    width: calc(100% - 240px);
    transition: width 0.3s;
    .z-head {
      height: 60px;
      width: 100%;
      border-bottom: @z-border;

      display: flex;
      justify-content: space-between;
      align-items: center;

      padding: 0 20px;
    }
    .z-actions {
      display: flex;
      align-items: center;

      svg {
        font-size: 18px;
        cursor: pointer;
        margin: 0 10px;
      }
    }

    .z-tabs {
      height: 30px;
      width: 100%;
      border-bottom: @z-border;
    }

    .z-container {
      height: calc(100vh - 90px);
      width: 100%;
      overflow-y: auto;
      overflow-x: hidden;
      background-color: @color-fill-2;
      padding: 20px;
      .z-base-view {
        background-color: var(--color-bg-1);
        border-radius: 5px;
        min-height: calc(100vh - 130px);
      }
    }
  }
}
// 组件刚开始离开
.fade-leave-active {
  transform: translateX(20px);
  opacity: 0;
}
// 组件离开结束
.fade-leave-to {
}
// 组件刚开始进入
.fade-enter-active {
  transform: translateX(-20px);
  opacity: 0;
}
// 组件进入结束
.fade-enter-to {
  transform: translateX(0);
  opacity: 1;
}

.fade-leave-active,
.fade-enter-active {
  transition: all 0.3s ease-out;
}
</style>
